use crate::components::basic::page::ApplicationPage;

#[derive(Clone)]
pub struct ResourceManager {
    pub resourec_manager_state: ResourceManagerState,
}

impl ResourceManager {
    pub fn default() -> Self {
        Self {
            resourec_manager_state: ResourceManagerState::List,
        }
    }
}

impl ApplicationPage for ResourceManager {
    fn show(&mut self, ctx: &egui::Context) {
        match self.resourec_manager_state {
            ResourceManagerState::Add => self.show_add(ctx),
            ResourceManagerState::Edit => self.show_edit(ctx),
            ResourceManagerState::List => self.show_list(ctx),
        }
    }
    fn show_list(&mut self, ctx: &egui::Context) {
        egui::CentralPanel::default().show(ctx, |ui| {
            ui.vertical_centered(|ui| {
                ui.heading("列表页面");
            });
        });
    }

    fn show_edit(&mut self, ctx: &egui::Context) {
        egui::CentralPanel::default().show(ctx, |ui| {
            ui.vertical_centered(|ui| {
                ui.heading("编辑页面");
            });
        });
    }

    fn show_add(&mut self, ctx: &egui::Context) {
        egui::CentralPanel::default().show(ctx, |ui| {
            ui.vertical_centered(|ui| {
                ui.heading("添加页面");
            });
        });
    }
}

#[derive(Clone)]
pub enum ResourceManagerState {
    List,
    Add,
    Edit,
}
